#include "common.h"

bool ans = false;
int arr[9][9];
int arr1[9][9];
int arr2[9][9];

bool isValidSudoku(vector<vector<char>>& board)
{
	for (int i = 0; i < 9; i++)
	{
		for (int j = 0; j < 9; j++)
		{
			if (board[i][j] != '.')
			{
				int num = board[i][j] - '1';
				int n = (i / 3) * 3 + (j / 3);
				if (arr1[i][num] == 0 && arr2[j][num] == 0 && arr[n][num] == 0)
				{
					arr1[i][board[i][j] - '1'] = 1;
					arr2[j][board[i][j] - '1'] = 1;
					arr[n][board[i][j] - '1'] = 1;
				}
				else
				{
					return false;
				}
			}
		}
	}

	return true;
}